#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <sys/stat.h>

#include "help/util.h"

// I have had a nasty problem here, which should be remembered when occuring once again
// Since the change from chroot to a root path, the 64 byte string were too small
// So memory was overwritten, which really shouldnt be

// For now, I made the strings 256 bytes big, but this is just a temp solution
// The best would be to determine the max path length and base the strings lengths on that
// Or create dynamic strings, which grow bigger when filled



int main(int argc, char* argv[]) {
    if (argc < 2) {
        return 1;
    }

    char* root = getenv("RELAT_ROOT");
    char* name = argv[1];

    // TODO: improve spawning position
    int id = generate_user_id(root);
    printf("%i\n", id);

    set_user_name(root, id, name);
    set_user_position(root, id, 10 * id, 10 * id, 0);

    printf("adam\n");
    create_unit_awoo(root, id, "adam", 1, 0);
    printf("eva\n");
    create_unit_awoo(root, id, "eva", -1, 0);

    return 0;
}
